<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - id:000977,sync:fuzzer2,src:001052.lcov_info_final - src/emitterstate.h</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - emitterstate.h<span style="font-size: 80%;"> (source / <a href="emitterstate.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">id:000977,sync:fuzzer2,src:001052.lcov_info_final</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">31</td>
            <td class="headerCovTableEntry">44</td>
            <td class="headerCovTableEntryLo">70.5 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2016-03-13 10:42:47</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">15</td>
            <td class="headerCovTableEntry">26</td>
            <td class="headerCovTableEntryLo">57.7 %</td>
          </tr>
          <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #ifndef EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66</a>
<span class="lineNum">       2 </span>            : #define EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
<span class="lineNum">       3 </span>            : 
<span class="lineNum">       4 </span>            : #if defined(_MSC_VER) ||                                            \
<span class="lineNum">       5 </span>            :     (defined(__GNUC__) &amp;&amp; (__GNUC__ == 3 &amp;&amp; __GNUC_MINOR__ &gt;= 4) || \
<span class="lineNum">       6 </span>            :      (__GNUC__ &gt;= 4))  // GCC supports &quot;pragma once&quot; correctly since 3.4
<span class="lineNum">       7 </span>            : #pragma once
<span class="lineNum">       8 </span>            : #endif
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : #include &quot;ptr_stack.h&quot;
<span class="lineNum">      11 </span>            : #include &quot;setting.h&quot;
<span class="lineNum">      12 </span>            : #include &quot;yaml-cpp/emitterdef.h&quot;
<span class="lineNum">      13 </span>            : #include &quot;yaml-cpp/emittermanip.h&quot;
<span class="lineNum">      14 </span>            : #include &lt;cassert&gt;
<span class="lineNum">      15 </span>            : #include &lt;vector&gt;
<span class="lineNum">      16 </span>            : #include &lt;stack&gt;
<span class="lineNum">      17 </span>            : #include &lt;memory&gt;
<span class="lineNum">      18 </span>            : #include &lt;stdexcept&gt;
<span class="lineNum">      19 </span>            : 
<span class="lineNum">      20 </span>            : namespace YAML {
<span class="lineNum">      21 </span>            : struct FmtScope {
<span class="lineNum">      22 </span>            :   enum value { Local, Global };
<span class="lineNum">      23 </span>            : };
<span class="lineNum">      24 </span>            : struct GroupType {
<span class="lineNum">      25 </span>            :   enum value { NoType, Seq, Map };
<span class="lineNum">      26 </span>            : };
<span class="lineNum">      27 </span>            : struct FlowType {
<span class="lineNum">      28 </span>            :   enum value { NoType, Flow, Block };
<span class="lineNum">      29 </span>            : };
<span class="lineNum">      30 </span>            : 
<span class="lineNum">      31 </span>            : class EmitterState {
<span class="lineNum">      32 </span>            :  public:
<span class="lineNum">      33 </span>            :   EmitterState();
<span class="lineNum">      34 </span>            :   ~EmitterState();
<a name="35"><span class="lineNum">      35 </span>            : </a>
<a name="36"><span class="lineNum">      36 </span>            :   // basic state checking</a>
<a name="37"><span class="lineNum">      37 </span><span class="lineCov">     165830 :   bool good() const { return m_isGood; }</span></a>
<span class="lineNum">      38 </span><span class="lineNoCov">          0 :   const std::string GetLastError() const { return m_lastError; }</span>
<span class="lineNum">      39 </span><span class="lineCov">         46 :   void SetError(const std::string&amp; error) {</span>
<span class="lineNum">      40 </span><span class="lineCov">         46 :     m_isGood = false;</span>
<span class="lineNum">      41 </span><span class="lineCov">         46 :     m_lastError = error;</span>
<span class="lineNum">      42 </span><span class="lineCov">         46 :   }</span>
<span class="lineNum">      43 </span>            : 
<span class="lineNum">      44 </span>            :   // node handling
<span class="lineNum">      45 </span>            :   void SetAnchor();
<span class="lineNum">      46 </span>            :   void SetTag();
<span class="lineNum">      47 </span>            :   void SetNonContent();
<span class="lineNum">      48 </span>            :   void SetLongKey();
<span class="lineNum">      49 </span>            :   void ForceFlow();
<span class="lineNum">      50 </span>            :   void StartedDoc();
<span class="lineNum">      51 </span>            :   void EndedDoc();
<span class="lineNum">      52 </span>            :   void StartedScalar();
<span class="lineNum">      53 </span>            :   void StartedGroup(GroupType::value type);
<span class="lineNum">      54 </span>            :   void EndedGroup(GroupType::value type);
<span class="lineNum">      55 </span>            : 
<span class="lineNum">      56 </span>            :   EmitterNodeType::value NextGroupType(GroupType::value type) const;
<span class="lineNum">      57 </span>            :   EmitterNodeType::value CurGroupNodeType() const;
<span class="lineNum">      58 </span>            : 
<span class="lineNum">      59 </span>            :   GroupType::value CurGroupType() const;
<span class="lineNum">      60 </span>            :   FlowType::value CurGroupFlowType() const;
<span class="lineNum">      61 </span>            :   int CurGroupIndent() const;
<span class="lineNum">      62 </span>            :   std::size_t CurGroupChildCount() const;
<span class="lineNum">      63 </span>            :   bool CurGroupLongKey() const;
<a name="64"><span class="lineNum">      64 </span>            : </a>
<a name="65"><span class="lineNum">      65 </span>            :   int LastIndent() const;</a>
<a name="66"><span class="lineNum">      66 </span><span class="lineCov">      46630 :   int CurIndent() const { return m_curIndent; }</span></a>
<a name="67"><span class="lineNum">      67 </span><span class="lineCov">       2617 :   bool HasAnchor() const { return m_hasAnchor; }</span></a>
<span class="lineNum">      68 </span><span class="lineCov">       4845 :   bool HasTag() const { return m_hasTag; }</span>
<span class="lineNum">      69 </span><span class="lineCov">      28248 :   bool HasBegunNode() const {</span>
<a name="70"><span class="lineNum">      70 </span><span class="lineCov">      28248 :     return m_hasAnchor || m_hasTag || m_hasNonContent;</span></a>
<span class="lineNum">      71 </span>            :   }
<span class="lineNum">      72 </span><span class="lineCov">      56857 :   bool HasBegunContent() const { return m_hasAnchor || m_hasTag; }</span>
<span class="lineNum">      73 </span>            : 
<span class="lineNum">      74 </span>            :   void ClearModifiedSettings();
<span class="lineNum">      75 </span>            : 
<span class="lineNum">      76 </span>            :   // formatters
<span class="lineNum">      77 </span>            :   void SetLocalValue(EMITTER_MANIP value);
<a name="78"><span class="lineNum">      78 </span>            : </a>
<span class="lineNum">      79 </span>            :   bool SetOutputCharset(EMITTER_MANIP value, FmtScope::value scope);
<span class="lineNum">      80 </span><span class="lineCov">      12107 :   EMITTER_MANIP GetOutputCharset() const { return m_charset.get(); }</span>
<a name="81"><span class="lineNum">      81 </span>            : </a>
<span class="lineNum">      82 </span>            :   bool SetStringFormat(EMITTER_MANIP value, FmtScope::value scope);
<span class="lineNum">      83 </span><span class="lineCov">      12107 :   EMITTER_MANIP GetStringFormat() const { return m_strFmt.get(); }</span>
<a name="84"><span class="lineNum">      84 </span>            : </a>
<span class="lineNum">      85 </span>            :   bool SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope);
<span class="lineNum">      86 </span><span class="lineNoCov">          0 :   EMITTER_MANIP GetBoolFormat() const { return m_boolFmt.get(); }</span>
<a name="87"><span class="lineNum">      87 </span>            : </a>
<span class="lineNum">      88 </span>            :   bool SetBoolLengthFormat(EMITTER_MANIP value, FmtScope::value scope);
<span class="lineNum">      89 </span><span class="lineNoCov">          0 :   EMITTER_MANIP GetBoolLengthFormat() const { return m_boolLengthFmt.get(); }</span>
<a name="90"><span class="lineNum">      90 </span>            : </a>
<span class="lineNum">      91 </span>            :   bool SetBoolCaseFormat(EMITTER_MANIP value, FmtScope::value scope);
<span class="lineNum">      92 </span><span class="lineNoCov">          0 :   EMITTER_MANIP GetBoolCaseFormat() const { return m_boolCaseFmt.get(); }</span>
<a name="93"><span class="lineNum">      93 </span>            : </a>
<span class="lineNum">      94 </span>            :   bool SetIntFormat(EMITTER_MANIP value, FmtScope::value scope);
<span class="lineNum">      95 </span><span class="lineNoCov">          0 :   EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); }</span>
<a name="96"><span class="lineNum">      96 </span>            : </a>
<span class="lineNum">      97 </span>            :   bool SetIndent(std::size_t value, FmtScope::value scope);
<span class="lineNum">      98 </span><span class="lineCov">      17385 :   int GetIndent() const { return m_indent.get(); }</span>
<a name="99"><span class="lineNum">      99 </span>            : </a>
<span class="lineNum">     100 </span>            :   bool SetPreCommentIndent(std::size_t value, FmtScope::value scope);
<a name="101"><span class="lineNum">     101 </span><span class="lineNoCov">          0 :   int GetPreCommentIndent() const { return m_preCommentIndent.get(); }</span></a>
<span class="lineNum">     102 </span>            :   bool SetPostCommentIndent(std::size_t value, FmtScope::value scope);
<span class="lineNum">     103 </span><span class="lineNoCov">          0 :   int GetPostCommentIndent() const { return m_postCommentIndent.get(); }</span>
<span class="lineNum">     104 </span>            : 
<span class="lineNum">     105 </span>            :   bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
<span class="lineNum">     106 </span>            :                    FmtScope::value scope);
<span class="lineNum">     107 </span>            :   EMITTER_MANIP GetFlowType(GroupType::value groupType) const;
<a name="108"><span class="lineNum">     108 </span>            : </a>
<span class="lineNum">     109 </span>            :   bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope);
<span class="lineNum">     110 </span><span class="lineCov">      17776 :   EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }</span>
<a name="111"><span class="lineNum">     111 </span>            : </a>
<span class="lineNum">     112 </span>            :   bool SetFloatPrecision(int value, FmtScope::value scope);
<a name="113"><span class="lineNum">     113 </span><span class="lineNoCov">          0 :   std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); }</span></a>
<span class="lineNum">     114 </span>            :   bool SetDoublePrecision(int value, FmtScope::value scope);
<span class="lineNum">     115 </span><span class="lineNoCov">          0 :   std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); }</span>
<span class="lineNum">     116 </span>            : 
<span class="lineNum">     117 </span>            :  private:
<span class="lineNum">     118 </span>            :   template &lt;typename T&gt;
<span class="lineNum">     119 </span>            :   void _Set(Setting&lt;T&gt;&amp; fmt, T value, FmtScope::value scope);
<span class="lineNum">     120 </span>            : 
<span class="lineNum">     121 </span>            :   void StartedNode();
<span class="lineNum">     122 </span>            : 
<span class="lineNum">     123 </span>            :  private:
<span class="lineNum">     124 </span>            :   // basic state ok?
<span class="lineNum">     125 </span>            :   bool m_isGood;
<span class="lineNum">     126 </span>            :   std::string m_lastError;
<span class="lineNum">     127 </span>            : 
<span class="lineNum">     128 </span>            :   // other state
<span class="lineNum">     129 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_charset;
<span class="lineNum">     130 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_strFmt;
<span class="lineNum">     131 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_boolFmt;
<span class="lineNum">     132 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_boolLengthFmt;
<span class="lineNum">     133 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_boolCaseFmt;
<span class="lineNum">     134 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_intFmt;
<span class="lineNum">     135 </span>            :   Setting&lt;std::size_t&gt; m_indent;
<span class="lineNum">     136 </span>            :   Setting&lt;std::size_t&gt; m_preCommentIndent, m_postCommentIndent;
<span class="lineNum">     137 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_seqFmt;
<span class="lineNum">     138 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_mapFmt;
<span class="lineNum">     139 </span>            :   Setting&lt;EMITTER_MANIP&gt; m_mapKeyFmt;
<span class="lineNum">     140 </span>            :   Setting&lt;int&gt; m_floatPrecision;
<span class="lineNum">     141 </span>            :   Setting&lt;int&gt; m_doublePrecision;
<span class="lineNum">     142 </span>            : 
<span class="lineNum">     143 </span>            :   SettingChanges m_modifiedSettings;
<a name="144"><span class="lineNum">     144 </span>            :   SettingChanges m_globalModifiedSettings;</a>
<a name="145"><span class="lineNum">     145 </span>            : </a>
<span class="lineNum">     146 </span><span class="lineCov">      17385 :   struct Group {</span>
<span class="lineNum">     147 </span><span class="lineCov">      17385 :     explicit Group(GroupType::value type_)</span>
<span class="lineNum">     148 </span><span class="lineCov">      17385 :         : type(type_), indent(0), childCount(0), longKey(false) {}</span>
<span class="lineNum">     149 </span>            : 
<span class="lineNum">     150 </span>            :     GroupType::value type;
<span class="lineNum">     151 </span>            :     FlowType::value flowType;
<span class="lineNum">     152 </span>            :     int indent;
<span class="lineNum">     153 </span>            :     std::size_t childCount;
<span class="lineNum">     154 </span>            :     bool longKey;
<span class="lineNum">     155 </span>            : 
<a name="156"><span class="lineNum">     156 </span>            :     SettingChanges modifiedSettings;</a>
<span class="lineNum">     157 </span>            : 
<span class="lineNum">     158 </span><span class="lineCov">      55007 :     EmitterNodeType::value NodeType() const {</span>
<span class="lineNum">     159 </span><span class="lineCov">      55007 :       if (type == GroupType::Seq) {</span>
<span class="lineNum">     160 </span><span class="lineCov">      18348 :         if (flowType == FlowType::Flow)</span>
<span class="lineNum">     161 </span><span class="lineCov">       5927 :           return EmitterNodeType::FlowSeq;</span>
<span class="lineNum">     162 </span>            :         else
<span class="lineNum">     163 </span><span class="lineCov">      12421 :           return EmitterNodeType::BlockSeq;</span>
<span class="lineNum">     164 </span>            :       } else {
<span class="lineNum">     165 </span><span class="lineCov">      36659 :         if (flowType == FlowType::Flow)</span>
<span class="lineNum">     166 </span><span class="lineCov">       3361 :           return EmitterNodeType::FlowMap;</span>
<span class="lineNum">     167 </span>            :         else
<span class="lineNum">     168 </span><span class="lineCov">      33298 :           return EmitterNodeType::BlockMap;</span>
<span class="lineNum">     169 </span>            :       }
<span class="lineNum">     170 </span>            : 
<span class="lineNum">     171 </span>            :       // can't get here
<span class="lineNum">     172 </span>            :       assert(false);
<span class="lineNum">     173 </span>            :       return EmitterNodeType::NoType;
<span class="lineNum">     174 </span>            :     }
<span class="lineNum">     175 </span>            :   };
<span class="lineNum">     176 </span>            : 
<span class="lineNum">     177 </span>            :   ptr_stack&lt;Group&gt; m_groups;
<span class="lineNum">     178 </span>            :   std::size_t m_curIndent;
<span class="lineNum">     179 </span>            :   bool m_hasAnchor;
<span class="lineNum">     180 </span>            :   bool m_hasTag;
<span class="lineNum">     181 </span>            :   bool m_hasNonContent;
<span class="lineNum">     182 </span>            :   std::size_t m_docCount;
<span class="lineNum">     183 </span>            : };
<a name="184"><span class="lineNum">     184 </span>            : </a>
<span class="lineNum">     185 </span>            : template &lt;typename T&gt;
<span class="lineNum">     186 </span><span class="lineCov">      34478 : void EmitterState::_Set(Setting&lt;T&gt;&amp; fmt, T value, FmtScope::value scope) {</span>
<span class="lineNum">     187 </span><span class="lineCov">      34478 :   switch (scope) {</span>
<span class="lineNum">     188 </span>            :     case FmtScope::Local:
<span class="lineNum">     189 </span><span class="lineCov">      34478 :       m_modifiedSettings.push(fmt.set(value));</span>
<span class="lineNum">     190 </span><span class="lineCov">      34478 :       break;</span>
<span class="lineNum">     191 </span>            :     case FmtScope::Global:
<span class="lineNum">     192 </span><span class="lineNoCov">          0 :       fmt.set(value);</span>
<span class="lineNum">     193 </span><span class="lineNoCov">          0 :       m_globalModifiedSettings.push(</span>
<span class="lineNum">     194 </span>            :           fmt.set(value));  // this pushes an identity set, so when we restore,
<span class="lineNum">     195 </span>            :       // it restores to the value here, and not the previous one
<span class="lineNum">     196 </span><span class="lineNoCov">          0 :       break;</span>
<span class="lineNum">     197 </span>            :     default:
<span class="lineNum">     198 </span><span class="lineNoCov">          0 :       assert(false);</span>
<span class="lineNum">     199 </span>            :   }
<span class="lineNum">     200 </span><span class="lineCov">      34478 : }</span>
<span class="lineNum">     201 </span>            : }
<span class="lineNum">     202 </span>            : 
<span class="lineNum">     203 </span>            : #endif  // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.11</a></td></tr>
  </table>
  <br>

</body>
</html>
